<!--tvm票款差异协查-->
<template>
  <div class="dantaishebeipiaohuanchayi HuikuiInfo el-card is-always-shadow el-card__body">
    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      @close="closed"
      width="80%">
      <avue-form v-if="isReload" :option="option" v-model="form" @submit="handleSubmit" class="huikuiForm">
        <template slot-scope="{row}" slot="lineCode">
          <span>{{getLineName(row.lineCode)}}</span>
        </template>
        <template slot-scope="{row}" slot="stationCode">
          <span>{{getStationName(row.lineCode,row.stationCode)}}</span>
        </template>
        <template slot-scope="{row}" slot="tvmCode">
          <span>{{row.tvmCode}}</span>
        </template>
        <template slot-scope="{row}" slot="incomeTime">
          <span>{{row.incomeTime}}</span>
        </template>
        <template slot-scope="{row}" slot="type">
          <span>{{row.type}}</span>
        </template>
        <template slot-scope="{row}" slot="saleAmount">
          <span>{{fenExYuangettoFixed(row,'saleAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="depositAmount">
          <span>{{fenExYuangettoFixed(row,'depositAmount')}}</span>
        </template>
        <template slot-scope="{row}" slot="errorRefundAmount">
          <span>{{ fenExYuangettoFixed(row,'errorRefundAmount')}}</span>
        </template>

        <template slot-scope="{row}" slot="replySaleMoney">
          <span>{{fenExYuangettoFixed(row,'replySaleMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replySaleMoneyCY">
          <span>{{ fenExYuangettoFixed(row,'replySaleMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyRechargeMoney">
          <span>{{ fenExYuangettoFixed(row,'replyRechargeMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyRechargeMoneyCY">
          <span>{{fenExYuangettoFixed(row,'replyRechargeMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyErrorReturnMoney">
          <span>{{fenExYuangettoFixed(row,'replyErrorReturnMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyErrorReturnMoneyCY">
          <span>{{fenExYuangettoFixed(row,'replyErrorReturnMoneyCY')}}</span>
        </template>
        <template slot-scope="{row}" slot="sumCY">
          <span>{{fenExYuangettoFixed(row,'sumCY')}}</span>
        </template>

        <template slot-scope="{row}" slot="diffMoney">
          <span>{{fenExYuangettoFixed(row,'diffMoney')}}</span>
        </template>
        <template slot-scope="{row}" slot="replyDiffMoney">
          <span>{{fenExYuangettoFixed(row,'replyDiffMoney')}}</span>
        </template>

        <template slot-scope="scope" slot="menuForm" >
          <el-button type="primary" @click="handleSubmit" v-if="form.replaceStatus!='1' && (form.assistCategory=='1' || (form.assistInvestStatus=='8' && form.assistCategory=='3')) && form.replyStatus=='1'">一键替换</el-button>
          <el-button type="primary" @click="$parent.isShowDia=false">返回</el-button>
        </template>
      </avue-form>
    </el-dialog>
  </div>
</template>


<script>
  import {getForm, postForm} from '@/api/gen/gen'
  import ExportJsonExcel from "js-export-excel";
  import {
    getSwAuTvmSingleAssistList,
    setSwAuTvmSingleAssist,cols1,getMondifyData1
  } from "../../../../../api/subwayRat/TVMRevenueVarianceAudit.TvmChaYiDXC/dantaishebeipiaohuanchayi";
  import {
    getLineName,
    getStationName,
    electromeReasons,
    fenExYuangettoFixed,
    getElectromeReasons
  } from "../../../../../api/subwayRat/commonCheck";

  export default {
    components:{
    },
    data() {
      return {
        isReload:true,
        masterId:'',
        //1编辑，2添加，3预览
        showType:1,
        replaceStatus:0,
        assistInvestStatus:0,
        dialogVisible:true,
	assistCategory:0,
        form:{
          dynamic: []
        },
        option:{
          group:{}
        }
    }
    },
    created() {

    },
    methods: {
      fenExYuangettoFixed,
      getLineName,
      getStationName,
      handleSubmit(form,done){
        //form.masterId=this.masterId;
        //form.replaceStatus=1; //以替换状态
        setSwAuTvmSingleAssist({ids:this.form.id}).then(res=>{
          if(res.data.code==0){
            this.$message.success("操作成功！");
            this.closed();
            this.$parent.getList();
            this.$parent.cancelChoose();
          }else{
            this.$message.error(res.data.msg);
          }
        }).catch(e=>{
          // this.$message.error("操作失败！");
        });

        done();
      },
      recallShow(id,row,showType){
        this.masterId=id;
        this.showType=showType;
        this.getOption();
        let th=this;
        this.form={};
        this.form.dynamic=row;
        Object.assign(this.form,row);
        let mondify1=getMondifyData1(row);
        this.form.dynamic=mondify1;
        this.jdReplyReason = row.jdReplyReason;
        this.kyReplyReason = row.kyReplyReason;
        this.replaceStatus = row.replaceStatus;
        this.assistInvestStatus = row.assistInvestStatus;
	this.assistCategory = row.assistCategory;
        // getSwAuTvmSingleAssistList({id:id}).then(res=>{
        //   Object.assign(th.form,res.data.data[0]);
        //   this.form.replyReason=getElectromeReasons(Number(this.form.replyReason));

        // })

      },
      closed(){
        this.$parent.isShowDia=false;
      },
      getOption(){

        let group1={
          icon:'',
          sortable:true,
          label: 'TVM单台设备票款差异信息回馈',
          // collapse:false,
          prop: 'group1',
          indexLabel:"#",
          column: [{
            label: '',
            prop: 'dynamic',
            type: 'dynamic',
            span:24,
            children: {
              addBtn:false,
              delBtn:false,
              sortable:true,
              index:false,
              indexLabel:"#",
              align: 'center',
              headerAlign: 'center',
              column: cols1
            }
          }
          ]
        };

        let group2={
          icon:'',
          label: '原因与备注',
          // collapse:false,
          prop: 'group2',
          column: [{
              label: '归属机电专业回馈差异原因',
              prop: 'replyReason',
              labelWidth:130,
              type:'select',
              dicData:electromeReasons(),
              disabled: true
            },
            {
              label: '归属车站回馈差异原因',
              prop: 'kyReplyReason',
              labelWidth:130,
              type:'select',
              dicData:electromeReasons(),
              disabled: true
            },
              {
                label: '机电专业详细描述',
                prop: 'replyContent',
                type: 'textarea',
                labelWidth:130,
                disabled: true
              },

              {
                label: '车站详细描述',
                prop: 'kyReplyDetail',
                type: 'textarea',
                labelWidth:130,
                disabled: true
              },
            {
              label: '车站备注',
              prop: 'stationCleanRemark',
              type: 'textarea',
              labelWidth:130,
              disabled: true
            },
            {
              label: '站长审核意见',
              prop: 'auditStationOpinion',
              type: 'textarea',
              labelWidth:130,
              disabled: true
            },
            {
              label: '车间票务专业审核意见',
              prop: 'auditWorkshopOpinion',
              type: 'textarea',
              labelWidth:130,
              disabled: true
            },
            {
              label: '部门票务专业审核意见',
              prop: 'auditDeptOpinion',
              type: 'textarea',
              labelWidth:130,
              disabled: true
            },
          ]
        };

        this.option={
          submitBtn:this.showType!=3,
          emptyBtn:false,
          //submitText:'一键替换',
          span:12,
          group:[]
        } ;
        this.option.group.push(group1);
        if(this.showType==3){
          this.option.group.push(group2);
        }else if(this.showType!=3){
        }
        this.isReload=false;
        this.$nextTick(()=>{
          this.isReload=true;
        })
      }
      // getOption(){
      //   this.option={
      //     submitBtn:this.showType!=3,
      //     emptyBtn:false,
      //     submitText:'一键替换',
      //     group:[
      //     {
      //       icon:'',
      //       sortable:true,
      //       label: 'TVM单台设备票款差异信息回馈',
      //       // collapse:false,
      //       prop: 'group1',
      //       indexLabel:"#",
      //       column: [{
      //         label: '',
      //         prop: 'dynamic',
      //         type: 'dynamic',
      //         span:24,
      //         children: {
      //           addBtn:false,
      //           sortable:true,
      //           index:false,
      //           indexLabel:"#",
      //           align: 'center',
      //           headerAlign: 'center',
      //           column: [{
      //             width: 100,
      //             label: '线路',
      //             prop: "lineCode",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '站点',
      //             prop: "stationCode",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: 'TVM编号',
      //             prop: "tvmCode",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '收入日期',
      //             prop: "incomeTime",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '售票金额',
      //             prop: "saleAmount",
      //             formslot: true,
      //           },{
      //             width: 100,
      //             label: '回馈售票金额',
      //             prop: "replySaleMoney",
      //             formslot: true,
      //           },{
      //             width: 100,
      //             label: '回馈后售票差异',
      //             prop: "replySaleMoneyCY",
      //             formslot: true,
      //           },{
      //             width: 100,
      //             label: '充值金额',
      //             prop: "depositAmount",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '回馈充值金额',
      //             prop: "replyRechargeMoney",
      //             formslot: true,
      //           },{
      //             width: 100,
      //             label: '回馈后充值差异',
      //             prop: "replyRechargeMoneyCY",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '退款金额',
      //             prop: "errorRefundAmount",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '回馈退款金额',
      //             prop: "replyErrorReturnMoney",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '回馈后退款差异',
      //             prop: "replyErrorReturnMoneyCY",
      //             formslot: true,
      //           }, {
      //             width: 100,
      //             label: '回馈后票款合计差异',
      //             prop: "sumCY",
      //             formslot: true,
      //           }]
      //         }
      //       }
      //       ]
      //     },
      //     {
      //       icon:'',
      //       label: '原因与备注',
      //       // collapse:false,
      //       prop: 'group2',
      //       column: [{
      //         label: '归属机电专业回馈差异原因',
      //         prop: 'replyReason',
      //         labelWidth:200,
      //         type:'select',
      //         dicData:electromeReasons(),
      //         disabled: true
      //       },
      //         {
      //           label: '机电专业详细描述',
      //           prop: 'replyContent',
      //           type: 'textarea',
      //           labelWidth:150,
      //           disabled: true
      //         }
      //       ]
      //     }
      //   ]};
      //   this.isReload=false;
      //   this.$nextTick(()=>{
      //     this.isReload=true;
      //   })
      // }
    },
    mounted() {

    }
  }
</script>
<style lang="scss">
  .dantaishebeipiaohuanchayi.HuikuiInfo{
    .avue-group[index='1']{
      .el-form-item{
          min-width: 450px;
        }
        .avue-form__row{
          width: 90%;
        }
    }
  }
</style>
